const {defineConfig} = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const {ElementPlusResolver} = require('unplugin-vue-components/resolvers')

module.exports = defineConfig({
    transpileDependencies: true,
    configureWebpack: {
        plugins: [
            AutoImport({
                resolvers: [ElementPlusResolver()],
                imports: ['vue'], // 自动导入 Vue 的 API
                dts: true, // 生成类型声明文件
            }),
            Components({resolvers: [ElementPlusResolver()]})
        ]
    },
    devServer: {
        port: 3000,
        open: true,
        compress: false, // 禁用 Gzip
        proxy: {
            '/dev-api': {
                target: process.env.VUE_APP_BASE_URL,
                pathRewrite: {'^/dev-api': ''},
                ws: true,
                secure: false
            }
        }
    }
})